package com.daify.threadlearn.chapter01.order03;

import java.util.ArrayList;
import java.util.List;

/**
 * @author daify
 * @date 2019-05-30
 */
public class MainTest {

    public static void main(String[] args) {
        List<Thread> threads = new ArrayList<Thread>();

        for (int i = 0; i < 5; i++) {
            Runnable run = new Runnable() {
                public void run() {
                    for (int j = 0; j < 20; j++) {
                        int next = UnsafeSequence.getNext();
                        System.out.println("此时值为：" + next);
                    }
                }
            };
            Thread thread = new Thread(run);
            threads.add(thread);
        }

        for (int i = 0; i < 5; i++) {
            threads.get(i).start();
        }
    }
}
